using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using System;
using Organized;
using System.Diagnostics;

namespace Game
{
    
    public class Game1 : Microsoft.Xna.Framework.Game
    {
        // The IGraphicsDeviceService the engine will use
        GraphicsDeviceManager graphics;

        // boolean to pause or unpause screen
        bool gamePaused = Config.PAUSED;

       


        public Game1()
        {
            // setup graphics
            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferWidth = Config.SCREEN_WIDTH;
            graphics.PreferredBackBufferHeight = Config.SCREEN_HEIGHT;

            
        }



       
        protected override void LoadContent()
        {
            // Setup engine
            Engine.SetupEngine(graphics);

            // Setup physics
            

            // Setup Input 
            MouseDevice mouse = new MouseDevice();
            KeyboardDevice keyboard = new KeyboardDevice();

            Engine.Services.AddService(typeof(MouseDevice), mouse);
            Engine.Services.AddService(typeof(KeyboardDevice), keyboard);

            //Add Physics
            Engine.Services.AddService(typeof(Physics), new Physics());
            //turn off physics
            //Engine.Services.GetService<Physics>().UpdatePhysics = false;
            //GameScreen backgroundScreen = new BackgroundScreen("BackgroundScreen");
            //setup two gamescreens (pause screen and gameplay screen)

            //backgrounds screen
            GameScreen backgroundScreen = new BackgroundScreen("BackgroundScreen");
            backgroundScreen.OverrideDrawBlocked = true; //always draw background screen

            GameScreen mainMenuScreen = new MainMenuScreen("MainMenuScreen");
            

            // GameScreen gameplayScreen = new GameplayScreen("GameplayScreen");
            //GameScreen pauseScreen = new PauseScreen("PauseScreen");
           
            //pauseScreen.BlocksDraw = false;//do draw the game when its on hold
            //pauseScreen.BlocksInput = true;
            //pauseScreen.BlocksUpdate = true;

            

            
        }

      
        protected override void Update(GameTime gameTime)
        {

            Engine.Update(gameTime);
           

            KeyboardDevice keyboard = Engine.Services.GetService<KeyboardDevice>();

           
          
            base.Update(gameTime);
        }

       
        protected override void Draw(GameTime gameTime)
        {           
          

            base.Draw(gameTime);

            // Draw the engine and game
            Engine.Draw(gameTime, ComponentType.All);


        }
    }
}
